# 1 设置django环境
# 2 创建celery对象
# 3 设置 broker
# 4 celery自动检测任务
import os

# 1 设置django环境
# set the default Django settings module for the 'celery' program.
from celery import Celery

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'meiduo_project.settings')

# 2 创建celery对象
app = Celery('celery_tasks')

# 3 设置 broker
app.config_from_object("celery_tasks.config")

# 4celery自动检测任务  这里会自动去celery_tasks.sms下找tasks.py
app.autodiscover_tasks(['celery_tasks.sms', 'celery_tasks.email'])
